package copyengine.resource
{
    import copyengine.resource.resProxy.CEResProxy;

    import flash.system.ApplicationDomain;

    import starling.textures.Texture;
    import starling.textures.TextureAtlas;

    public class CEResUtils
    {
        public function CEResUtils()
        {
        }


        public static function getSpriteOrMovieClip(_symbolName:String, _fileName:String, _resProxy:CEResProxy):*
        {
            var domain:ApplicationDomain = _resProxy.getRes(_fileName);
            var msClass:Class = domain.getDefinition(_symbolName) as Class;
            return new msClass();
        }

        public static function getTexture(_fileName:String, _resProxy:CEResProxy):Texture {return _resProxy.getRes(_fileName);}

        public static function getTextureAtlas(_fileName:String, _resProxy:CEResProxy):TextureAtlas {return _resProxy.getRes(_fileName);}

        public static function getTextureFromAtlas(_fileName:String, _symbolName:String, _resProxy:CEResProxy):Texture {return getTextureAtlas(_fileName, _resProxy).getTexture(_symbolName);}

        public static function getDecompressedObj(_fileName:String, _resProxy:CEResProxy):* {return _resProxy.getRes(_fileName);}

        public static function getJSONObj(_fileName:String, _resProxy:CEResProxy):Object {return _resProxy.getRes(_fileName);}

        public static function getXML(_fileName:String, _resProxy:CEResProxy):XML {return _resProxy.getRes(_fileName);}

    }

}
